<template>
	<view>
		<view class="search">
			<input type="text" v-model="sousuo" placeholder="请输入订单号、货物名称、装卸地、日期" />
			<view @click="kaishishous()">搜索</view>
		</view>
		<view class="container">
			<view class="current">
				<view class="current_top">
					<view class="fl">我的运单</view>
					<view class="fr">
						<text>全部</text>
						<image src="../../static/iocn11.png"></image>
					</view>
				</view>
				<view class="current_box">
					<view :class="navIndex==0?'active':''" @click="checkIndex(0)">
						<image src="../../static/iocn19.png"></image>
						<text>待报价</text>
					</view>
					<view :class="navIndex==1?'active':''" @click="checkIndex(1)">
						<image src="../../static/iocn20.png"></image>
						<text>运输中</text>
					</view>
					<view :class="navIndex==2?'active':''" @click="checkIndex(2)">
						<image src="../../static/iocn21.png"></image>
						<text>待结算</text>
					</view>
					<view :class="navIndex==3?'active':''" @click="checkIndex(3)">
						<image src="../../static/iocn22.png"></image>
						<text>已完成</text>
					</view>
					<view :class="navIndex==4?'active':''" @click="checkIndex(4)">
						<image src="../../static/iocn23.png"></image>
						<text>订单取消</text>
					</view>
				</view>
			</view>

			<!-- 待确认 -->
			
				<!-- <view class="down">
					<view :class="indexnav==0?'active':''" @click="indexkndex(0)">待确认</view>
					<view :class="indexnav==1?'active':''" @click="indexkndex(1)">待报价</view>
				</view> -->
				<view v-if="navIndex==0" >
					<view class="success" @click="detailed(item)" v-for="(item,index) in lista">
						<view class="success_top">
							<view class="fl">
								<view class="viewtop">待报价</view>
								<view class="viewkey">{{item.waybillNumber}}</view>
								<view class="viewbox" @click.stop="paste(item)">复制</view>
							</view>
							<view class="fr">{{item.creationTime}}</view>
						</view>
						<view class="success_key">
							<view class="viewtop">
								<text>{{item.shipZone}}</text>
								<image src="../../static/iocn4.png"></image>
								<text>{{item.receiveZone}}</text>
							</view>
							<view class="viewbox">
								<text>货物信息：{{item.goodsName}} / {{item.goodsWeight}}T / {{item.goodsSize}}m³ / {{item.goodsPackagMethod}}</text>
								<text>车辆信息：{{item.lesscarload}} / {{item.demandLoad}}T / {{item.demandLength}}米 / {{item.demandStyle}} </text>
							</view>
						</view>
						<view class="success_box">
							<view class="viewtop">确认报价</view>
							<view @click.stop="WayBillCancel(item)">取消运单</view>
						</view>
					</view>
					<view v-if="lista == 0">
						<u-empty mode="message" icon="http://cdn.uviewui.com/uview/empty/message.png"></u-empty>
					</view>
				</view>
			<!-- 运输中 -->
			<view v-if="navIndex==1">
				<view class="success" v-for="(item,index) in listb">
					<view class="success_top">
						<view class="fl">
							<view class="viewtop">运输中</view>
							<view class="viewkey">{{item.waybillNumber}}</view>
							<view class="viewbox" @click.stop="paste(item)">复制</view>
							
						</view>
						<view class="fr" @click="wzhankai(index,item)">
							<text>展开详情</text>
							<image src="../../static/iocn14.png" v-if="navindexnav == index"></image>
							<image src="../../static/iocn12.png" v-else></image>
						</view>
					</view>
					<view class="success_key">
						<view class="viewtop">
							<text>{{item.shipZone}}</text>
							<image src="../../static/iocn4.png"></image>
							<text>{{item.receiveZone}}</text>
						</view>
						<view class="viewbox">
							<text>货物信息：{{item.goodsName}} / {{item.goodsWeight}}T / {{item.goodsSize}}m³ / {{item.goodsPackagMethod}}</text>
							<text>车辆信息：{{item.lesscarload}} / {{item.demandLoad}}T / {{item.demandLength}}米 / {{item.demandStyle}} </text>
						</view>
					</view>
					<view v-if="navindexnav == index">
						<view class="descrip_top">
							<view class="box_box">装</view>
							<view class="descr_box">
							<text v-if="item.shipCompany=='null'">个体经营</text>
							<text v-else>{{item.shipCompany}}</text>
								<text>{{item.shipAddress}}</text>
							</view>
						</view>
						<view class="descrip_top">
							<view class="box_key">卸</view>
							<view class="descr_box">
								<text v-if="item.receiveCompany==''">个体经营</text>
								<text v-else>{{item.receiveCompany}}</text>
								<text>{{item.receiveAddress}}</text>
							</view>
						</view>
						<view class="warn" @click="bohao(item)">
							<image src="../../static/iocn27.png"></image>
							<text class="warnkey">联系司机</text>
							<text v-if="drivermobile==null"></text>
							<text v-else>{{drivermobile}}</text>
						</view>

						<view class="group" v-for="(itema,index) in item.deliveryItems">
							<view class="group_fl">
								<view>{{itema.deliveryStatus}}</view>
								<text>{{itema.creationTime}}</text>
							</view>
							<view class="group_fr">{{itema.remark}}</view>
						</view>
					</view>
					<view class="success_box">
						<view class="viewtop" @click="toditu(item)">查看地图</view>
						<view class="viewtop" @click="WayBillReceipt(item)">确认收货</view>
					</view>
				</view>
				
				<view v-if="listb == 0">
					<u-empty mode="message" icon="http://cdn.uviewui.com/uview/empty/message.png"></u-empty>
				</view>
			</view>
			<!-- 待结算 -->
			<view v-if="navIndex==2">
				<view class="success" v-for="(item,index) in listc">
					<view class="success_top">
						<view class="fl">
							<view class="viewtop">待结算</view>
							<view class="viewkey">{{item.waybillNumber}}</view>
							<view class="viewbox" @click.stop="paste(item)">复制</view>
						</view>
						<view class="fr">{{item.creationTime}}</view>
					</view>
					<view class="success_key">
						<view class="viewtop">
							<text>{{item.shipZone}}</text>
							<image src="../../static/iocn4.png"></image>
							<text>{{item.receiveZone}}</text>
						</view>
						<view class="viewbox">
							<text>货物信息：{{item.goodsName}} / {{item.goodsWeight}}T / {{item.goodsSize}}m³ / {{item.goodsPackagMethod}}</text>
							<text>车辆信息：{{item.lesscarload}} / {{item.demandLoad}}T / {{item.demandLength}}米 / {{item.demandStyle}} </text>
						</view>
					</view>

					<view class="contact">
						<view class="contact_top">
							<view><text>总运费：</text><text class="viewtop">{{item.amountTotal}}/趟</text></view>
							<view>
								<text>订&#12288;金：{{item.deposit}}元</text>
								<text class="viewbox" v-if="item.returnDeposit == true">（可退回）</text>
								<text class="viewbox" v-else>（不可退还）</text>
							</view>
						</view>
						<view class="contact_key" v-if="item.returnDeposit == true">（订金支付至平台通宝，货主确认收货后由平台立即退还）</view>
						<view class="contact_key" v-else></view>
					</view>

					<view class="success_box success_bos">
						<view class="viewtop"  @click="CreateTrade(item)">运费结算</view>
					</view>
				</view>
				<view v-if="listc == 0">
					<u-empty mode="message" icon="http://cdn.uviewui.com/uview/empty/message.png"></u-empty>
				</view>
			</view>
			<!-- 已完成 -->
			<view v-if="navIndex==3">
				<view class="success" v-for="(item,index) in listd">
					<image src="../../static/iocn28.png" class="retreat"></image>
					<view class="success_top">
						<view class="fl">
							<view class="viewtop">已完成</view>
							<view class="viewkey">{{item.waybillNumber}}</view>
							<view class="viewbox" @click.stop="paste(item)">复制</view>
						</view>
						<view class="fr">{{item.creationTime}}</view>
					</view>
					<view class="success_key">
						<view class="viewtop">
							<text>{{item.shipZone}}</text>
							<image src="../../static/iocn4.png"></image>
							<text>{{item.receiveZone}}</text>
						</view>
						<view class="viewbox">
							<text>货物信息：{{item.goodsName}} / {{item.goodsWeight}}T / {{item.goodsSize}}m³ / {{item.goodsPackagMethod}}</text>
							<text>车辆信息：{{item.lesscarload}} / {{item.demandLoad}}T / {{item.demandLength}}米 / {{item.demandStyle}} </text>
						</view>
					</view>

					<view class="contact">
						<view class="contact_top">
							<view><text>总运费：</text><text class="viewtop">{{item.amountTotal}}/趟</text></view>
							<view>
								<text>订&#12288;金：{{item.deposit}}元</text>
								<text class="viewbox" v-if="item.returnDeposit == true">（可退回）</text>
								<text class="viewbox" v-else>（不可退还）</text>
							</view>
						</view>
					</view>


				</view>
				<view v-if="listd == 0">
					<u-empty mode="message" icon="http://cdn.uviewui.com/uview/empty/message.png"></u-empty>
				</view>
			</view>
			<!-- 订单取消 -->
			<view v-if="navIndex==4">
				<view class="down">
					<view :class="navndex==0?'active':''" @click="checkndex(0)">已成交</view>
					<view :class="navndex==1?'active':''" @click="checkndex(1)">未成交</view>
				</view>
				<view v-if="navndex==0">
					<view v-for="(item,index) in liste">
						<view class="success">
							<view class="success_top">
								<view class="fl">
									<view class="viewtop">已成交</view>
									<view class="viewkey">{{item.waybillNumber}}</view>
									<view class="viewbox" @click.stop="paste(item)">复制</view>
								</view>
								<view class="fr">{{item.creationTime}}</view>
							</view>
							<view class="success_key">
								<view class="viewtop">
									<text>{{item.shipZone}}</text>
									<image src="../../static/iocn4.png"></image>
									<text>{{item.receiveZone}}</text>
								</view>
								<view class="viewbox">
									<text>货物信息：{{item.goodsName}} / {{item.goodsWeight}}T / {{item.goodsSize}}m³ / {{item.goodsPackagMethod}}</text>
									<text>车辆信息：{{item.lesscarload}} / {{item.demandLoad}}T / {{item.demandLength}}米 / {{item.demandStyle}} </text>
								</view>
							</view>
						
						
							<view class="contact">
								<view class="contact_top">
									<view><text>总运费：</text><text class="viewtop">{{item.amountTotal}}/趟</text></view>
									<view>
										<text>订&#12288;金：{{item.deposit}}元</text>
										<text class="viewbox" v-if="item.returnDeposit == true">（可退回）</text>
										<text class="viewbox" v-else>（不可退还）</text>
									</view>
								</view>
							</view>
						
							<view class="seperate">
								<view class="seperate_fl">
									<text v-if="!item.cancelReason == 'null'">取消原因：{{item.cancelReason}}</text>
									<!-- <view>请点击选择</view> -->
								</view>
								<view class="seperate_fr" @click="ptjr()">平台介入</view>
							</view>
						</view>
					</view>
					<view v-if="liste == 0">
						<u-empty mode="message" icon="http://cdn.uviewui.com/uview/empty/message.png"></u-empty>
					</view>
				</view>
				<view v-if="navndex==1">
					<view  v-for="(item,index) in listf">
						<view class="success">
							<view class="success_top">
								<view class="fl">
									<view class="viewtop">未成交</view>
									<view class="viewkey">{{item.waybillNumber}}</view>
									<view class="viewbox" @click.stop="paste(item)">复制</view>
								</view>
								<view class="fr">{{item.creationTime}}</view>
							</view>
							<view class="success_key">
								<view class="viewtop">
									<text>{{item.shipZone}}</text>
									<image src="../../static/iocn4.png"></image>
									<text>{{item.receiveZone}}</text>
								</view>
								<view class="viewbox">
									<text>货物信息：{{item.goodsName}} / {{item.goodsWeight}}T / {{item.goodsSize}}m³ / {{item.goodsPackagMethod}}</text>
									<text>车辆信息：{{item.lesscarload}} / {{item.demandLoad}}T / {{item.demandLength}}米 / {{item.demandStyle}} </text>
								</view>
							</view>
						
						
							<view class="contact">
								<view class="contact_top">
									<view><text>总运费：</text><text class="viewtop">{{item.amountTotal}}元/趟</text></view>
									<view><text>订&#12288;金：{{item.deposit}}元</text><text class="viewbox" v-if="item.returnDeposit == true">（可退还）</text><text class="viewbox" v-else>（不可退还）</text></view>
								</view>
							</view>
						
							<!-- <view class="seperate">
								<view class="seperate_fl">
									<text>取消原因：</text>
									<view>请点击选择</view>
								</view>
								<view class="seperate_fr">平台介入</view>
							</view> -->
						</view>
					</view>
					<view v-if="listf == 0">
						<u-empty mode="message" icon="http://cdn.uviewui.com/uview/empty/message.png"></u-empty>
					</view>
				</view>
			</view>

		</view>

		<!-- 弹窗 -->
		<view class="screenshot" v-show="notification">
			<view class="screenshot_key">
				<uni-icons  type="closeempty" size="30" class="image_top" @click="guanbi()"></uni-icons>
				<view class="screenshot_top">平台介入</view>
				<view class="screenshot_box">
					<text @click="guestbook()">申请后台留言</text>
					<text @click="bodakefu()">拨打客服电话</text>
				</view>
			</view>
		</view>
		
		<view class="screenshot" v-show="dianjixuanz">
			<view class="screenshot_key">
				<uni-icons  type="closeempty" size="30" class="image_top" @click="guanbi()"></uni-icons>
				<view class="screenshot_list">
					<text>订单未承运</text>
					<view>请确认货物未进行运输</view>
				</view>
				<view class="screensview">
					<view @click="ckndex(1)">
						<text>货主原因</text>
						<image src="../../static/iocn25.png" v-if="nandex == 1"></image>
						<image src="../../static/iocn26.png" v-else></image>
					</view>
					<view @click="ckndex(0)">
						<text>司机原因</text>
						<image src="../../static/iocn25.png" v-if="nandex == 0"></image>
						<image src="../../static/iocn26.png" v-else></image>
					</view>
				</view>
				<input type="text" v-model="reason" placeholder="请输入取消原因"/>
				<view class="screeiew" @click="queding()">确认</view>
			</view>
		</view>
		<view>
			<Tabbar :current="'0'"></Tabbar>
		</view>
	</view>
</template>

<script>
	import {GetWaybillList,WayBillCancel,CallRecordCreate,WayBillReceipt,CreateTrade,MiniProgramPay,GetUserById} from '@/public/Api/update.js'
	import {
		setValue,
		getValue
	} from '@/public/storeage/index.js'
	import Tabbar from '@/pages/navigation/navigation.vue';
	export default {
		components: {
			//注册组件
			Tabbar
		},
		data() {
			return {
				navIndex: 0,
				wyincang: true,
				wvheiget: 'none',
				navndex: 0,
				notification: false,
				dianjixuanz:false,
				nandex:0,
				skipCount:0,
				maxResultCount:10,
				drivermobile:'',
				driverName:'',
				indexnav:0,
				navindexnav:50,
				lista:[],
				listb:[],
				listc:[],
				listd:[],
				liste:[],
				listf:[],
				listr:[],				
				payDestination: 3,
				canInvoiced: false,
				reason:'',
				sousuo:'',
				userId: '',
			};
		},
		onShow() {
			this.userId =  getValue('id')
			this.daibaojiao() //  我的运单 -- 待确定
		},
		methods: {
			
			checkIndex(e) {
				this.navIndex = e
				var indexnav = e
				if (indexnav == 0){
					this.daibaojiao() //  我的运单 -- 待确定
				}else if(indexnav == 1){
					this.yunshuzhong() //  我的运单 -- 运输中
				}else if(indexnav == 2){
					this.daijiesuan() //  我的运单 -- 待结算
				}else if(indexnav == 3){
					this.yiwancheng() //  我的运单 -- 已完成
				}else if(indexnav == 4){
					this.yichengjiao() //  我的运单 -- 订单取消 -- 已成交
				}
			},
			checkndex(e) {
				this.navndex = e
				var indexnav = e
				if (indexnav == 0){
					this.yichengjiao() //  我的运单 -- 订单取消 -- 已成交
				}else if(indexnav == 1){
					this.weichengjiao() //  我的运单 -- 订单取消 -- 未成交
				}
			},
			
			// indexkndex(e) {
			// 	this.indexnav = e
			// 	var indexnav = e
			// 	if (indexnav == 0){
			// 		this.daiqueding() //  我的运单 -- 待确定
			// 	}else if(indexnav == 1){
			// 		this.daibaojiao()//  我的运单 -- 待报价
			// 	}
			// },
			
			ckndex(e){
				this.nandex = e
			},
			wzhankai(index,item) {
				this.navindexnav = index
				this.GetUserById(item.driverId)
			},
			ptjr(){
				this.notification = true
			},
			guanbi(){
				this.notification = false
				this.dianjixuanz = false
			},
			
			detailed(e){
				var id = e.id
				uni.navigateTo({
					url: '/pages/Mywaybill/detailed?id=' + id
				})
			},
			
			detailedac(e){
				var yudanid = e.id
				setValue('yudanid',yudanid);
				uni.navigateTo({
					url: '/pages/Releasesource/Confirm',
				})
			},
			
			guestbook(){
				uni.navigateTo({
					url: '/pages/guestbook/guestbook',
				})
			},
			
			//  我的运单 -- 待确定 -- 待确定
			// async daiqueding() {
			// 	var skipCount = this.skipCount
			// 	var maxResultCount = this.maxResultCount
			// 	try {
			// 		const {
			// 			data: res
			// 		} = await GetWaybillList({
			// 			skipCount,
			// 			maxResultCount,
			// 			status:0
			// 		})
			// 		this.lista = res.result.items
			// 	} catch (e) {}
			// },
			//  我的运单 -- 待确定 -- 待报价
			async daibaojiao() {
				var skipCount = this.skipCount
				var maxResultCount = this.maxResultCount
				try {
					const {
						data: res
					} = await GetWaybillList({
						skipCount,
						maxResultCount,
						status:1,
						shiperId:this.userId
					})
					this.lista = res.result.items
				} catch (e) {}
			},
			
			//  我的运单 -- 运输中
			async yunshuzhong() {
				var skipCount = this.skipCount
				var maxResultCount = this.maxResultCount
				try {
					const {
						data: res
					} = await GetWaybillList({
						skipCount,
						maxResultCount,
						status:6,
						shiperId:this.userId
					})
					this.listb = res.result.items
				} catch (e) {}
			},
			//获取用户详情
			async GetUserById(item){
				var id=item
			try {
				const {
					data: res
				} = await GetUserById({
					id
				})
				this.drivermobile=res.result.mobile
				this.driverName=res.result.trueName
			} catch (e) {}
			},
			//跳转地图
			toditu(item){
				console.log('运单',item)
				this.GetUserById(item.driverId)
				setTimeout(()=>{
					uni.navigateTo({
						url:'/pages/Mywaybill/ditu?shipLocation='+item.shipLocation+'&receiveLocation='+item.receiveLocation+'&time='+item.creationTime+'&waybillId='+item.id+'&driverId='+item.driverId+'&shipZone='+item.shipZone+'&receiveZone='+item.receiveZone+'&waybillNumber='+item.waybillNumber+'&goodsName='+item.goodsName+'&driverName='+this.driverName+'&drivermobile='+this.drivermobile+'&shiperId='+item.shiperId
					})
				},1000)
				
			},
			
			
			//  我的运单 -- 待结算
			async daijiesuan() {
				var skipCount = this.skipCount
				var maxResultCount = this.maxResultCount
				try {
					const {
						data: res
					} = await GetWaybillList({
						skipCount,
						maxResultCount,
						status:3,
						shiperId:this.userId
					})
					this.listc = res.result.items
				} catch (e) {}
			},
			
			//  我的运单 -- 已完成
			async yiwancheng() {
				var skipCount = this.skipCount
				var maxResultCount = this.maxResultCount
				try {
					const {
						data: res
					} = await GetWaybillList({
						skipCount,
						maxResultCount,
						status:4,
						shiperId:this.userId
					})
					this.listd = res.result.items
				} catch (e) {}
			},
			
			//  我的运单 -- 订单取消 -- 已成交
			async yichengjiao() {
				var skipCount = this.skipCount
				var maxResultCount = this.maxResultCount
				try {
					const {
						data: res
					} = await GetWaybillList({
						skipCount,
						maxResultCount,
						status:5,
						isReceipt:1,
						shiperId:this.userId
					})
					this.liste = res.result.items
				} catch (e) {}
			},
			
			//  我的运单 -- 订单取消 -- 未成交
			async weichengjiao() {
				var skipCount = this.skipCount
				var maxResultCount = this.maxResultCount
				try {
					const {
						data: res
					} = await GetWaybillList({
						skipCount,
						maxResultCount,
						status:5,
						isReceipt:0,
						shiperId:this.userId
					})
					this.listf = res.result.items
				} catch (e) {}
			},
			
			
			//  货主取消运单 
			
			async WayBillCancel(e) {
				var id = e.id
				setValue('huozhuqix', id);
				this.dianjixuanz = true
			},
			
			async queding(){
				var id = getValue('huozhuqix')
				var reason = this.reason
				var cancelBy = this.nandex
				try {
					const {
						data: res
					} = await WayBillCancel({
						id,
						reason,
						cancelBy
					})
					this.dianjixuanz = false
					this.daiqueding() //  我的运单 -- 待确定
					this.daibaojiao()//  我的运单 -- 待报价
				} catch (e) {}
			},
			
			
			
			// 复制
			paste(value) {
				var fuzhi = value.waybillNumber
			    uni.setClipboardData({
			        data: fuzhi
			    });
			},
			
			
			
			
			
			// 拨打电话
			 bohao(e) {
				var phone = this.drivermobile
				var item = e
				uni.makePhoneCall({
					phoneNumber: phone,
					success:(res) =>{
						this.CallRecordCreate(item);
					},
					fail:(res) =>  {
						console.log('打电话失败了');
					}
				})
			},
			
			// 创建通话记录
			async CallRecordCreate(item) {
				var waybillId = item.id
				var driverId = item.driverId
				var consignorId = item.shiperId
				try {
					const {
						data: res
					} = await CallRecordCreate({
						waybillId,
						driverId,
						consignorId
					})
					
				} catch (e) {}
			},
			
			//  货主确认收货
			async WayBillReceipt(item) {
				var id = item.id
				try {
					const {
						data: res
					} = await WayBillReceipt({
						id
					})
					if(res.success===true){
						setTimeout(()=>{
							uni.showToast({
							title: `收货成功`,
							icon: 'none',
							duration:2000
						})
						},200)
					}else{
							uni.showToast({
							title: "收货成功",
							icon: 'none',
							duration:2000
						})
					}
					this.yunshuzhong()
				} catch (e) {}
			},
			
			
			// 创建交易订单 运费结算
			async CreateTrade(item) {
				var payerUserId = getValue('id')
				var amount = item.amountTotal 
				var payDestination = this.payDestination
				var canInvoiced = this.canInvoiced
				var waybillId = item.id
				var payType = 2
				var payeeUserId = item.driverId
				setValue('totalactFee', amount);
				console.log({
						payerUserId,
						amount,
						payDestination,
						canInvoiced,
						waybillId,
						payeeUserId,
						payType
					})
				try {
					const {
						data: res
					} = await CreateTrade({
						payerUserId,
						amount,
						payDestination,
						canInvoiced,
						waybillId,
						payeeUserId,
						payType
					})
					this.MiniProgramPay(res.result.data.tradeNumber)
				} catch (e) {}
			},
			async MiniProgramPay(res) {
				console.log(res,'11111111111111111')
				var outTradeNo = res
				var body = 'string'
				var talact = getValue('totalactFee') * 100
				var totalFee = JSON.parse(talact)
				var spBillCreateIp = '127.0.0.1'
				var notifyUrl = 'https://pay.syh56.com:44352/api/WeChatPayNotify/Unifiedorder'
				var tradeType = 'JSAPI'
				var openId = getValue('wxOpenId')
				uni.request({
					url: "https://pay.syh56.com:44352/api/WeChatPay/MiniProgramPay",
					method: "post",
					header: {
						'Abp.TenantId': '1',
						'Content-Type': "application/json",
					},
					data: {
						outTradeNo,
						body,
						totalFee,
						spBillCreateIp,
						notifyUrl,
						tradeType,
						openId
					},
					success: (res) => {
					var parameter = JSON.parse(res.data.parameter)
						this.doWxPay(parameter)
					}
				})
			},
			
			
			doWxPay(parameter) {
				var param = parameter
				//小程序发起微信支付
				uni.requestPayment({
					nonceStr: param.nonceStr,
					timeStamp: param.timeStamp, //记住，这边的timeStamp一定要是字符串类型的，不然会报错
					// out_trade_no: param.out_trade_no,
					appId: param.appId,
					package: param.package,
					signType: param.signType,
					paySign: param.paySign,
					success: function(event) {
						uni.showToast({
							title: '支付成功',
							icon: 'success',
							duration: 2000
						});
						this.daijiesuan()
					},
					fail: function(error) {
						uni.showToast({
							title: '支付失败',
							icon: 'error',
							duration: 2000
						});
					},
					complete: function() {
						console.log("pay complete")
					}
				});
			},
			
			
			
			
			// 拨打客服电话
			 bodakefu() {
				var phone = '85708887'
				uni.makePhoneCall({
					phoneNumber: phone,
					success:(res) =>{
						this.CallRecordCreate(item);
					},
					fail:(res) =>  {
						console.log('打电话失败了');
					}
				})
			},
			
			
			// 搜索订单
			async kaishishous(){
				var keywords = this.sousuo
				var navIndex = this.navIndex
				var navndex = this.navndex
				var indexnav = this.indexnav
				var skipCount = this.skipCount
				var maxResultCount = this.maxResultCount
				// console.log(data)
				if (keywords == '') {
					uni.showToast({
						title: "搜索内容不能为空",
						icon: 'none',
						duration: 2000
					})
					return false
				}
				if (navIndex == 0) {
					var status = 1
					var data = {
						skipCount,
						maxResultCount,
						status,
						keywords
					}
				}else if(navIndex == 1){
					var dStatus = 3
					var data = {
						skipCount,
						maxResultCount,
						dStatus,
						keywords
					}
				}else if(navIndex == 2){
					var status = 3
					var data = {
						skipCount,
						maxResultCount,
						status,
						keywords
					}
				}else if(navIndex == 3){
					var status = 4
					var data = {
						skipCount,
						maxResultCount,
						status,
						keywords
					}
				}else if(navIndex == 4){
					if(navndex == 0){
						var status = 5
						var isReceipt = 1
						var data = {
							skipCount,
							maxResultCount,
							status,
							isReceipt,
							keywords
						}
					}else if(navndex == 1){
						var status = 5
						var isReceipt = 0
						var data = {
							skipCount,
							maxResultCount,
							status,
							isReceipt,
							keywords
						}
					}
				}
				// console.log(datac.toString())
				// var datat = datac.toString()
				// return false
				try {
					const {
						data: res
					} = await GetWaybillList(data)
					if (navIndex == 0) {
						this.lista = res.result.items
						console.log('lista',this.lista)
					}else if(navIndex == 1){
						this.listb = res.result.items
					}else if(navIndex == 2){
						this.listc = res.result.items
					}else if(navIndex == 3){
						this.listd = res.result.items
					}else if(navIndex == 4){
						if(navndex == 0){
							this.liste = res.result.items
						}else if(navndex == 1){
							this.listf = res.result.items
						}
					}
				} catch (e) {}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f7f7f7;
	}

	.screenshot {
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.4);
		position: fixed;
		top: 0;
		left: 0;
		z-index: 9999;
		.screenshot_key {
			width: 676.4upx;
			opacity: 1;
			background: #FFFFFF;
			box-shadow: 1.75upx 1.75upx 7.01upx 0px #e5e5e5;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			border-radius: 20upx;
			.image_top{
				position: absolute;
				top: 8upx;
				right: 48upx;
				width: 32upx;
				height: 32upx;
			}
			.screenshot_top{
				font-size: 32upx;
				text-align: center;
				padding: 37upx 0;
				border-bottom: 2upx solid #e5e5e5;
				font-weight: bold;
			}
			.screenshot_box{
				padding: 20upx 0 50upx 0;
				text{
					display: block;
					text-align: center;
					font-size: 28upx;
					color: #EF4D3D;
					padding-top: 30upx;
				}
			}
			
			.screenshot_list{
				padding: 48upx 0 35upx 44upx;
				border-bottom: 2upx solid #e5e5e5;
				text{
					display: block;
					font-size: 32upx;
					color: #EF4D3D;
					font-weight: bold;
				}
				view{
					display: inline-block;
					font-size: 24upx;
					color: #383838;
					line-height: 42upx;
					padding: 0 16upx;
					background-color: rgba(240, 77, 62, 0.1);
				}
			}
			.screensview{
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 50upx 40upx;
				view{
					image{
						width: 28upx;
						height: 28upx;
					}
					text{
						font-size: 32upx;
						font-weight: bold;
						padding-right: 28upx;
					}
				}
			}
			.screeiew{
				width: 190upx;
				height: 72upx;
				line-height: 72upx;
				font-size: 31upx;
				color: #fff;
				text-align: center;
				font-weight: bold;
				border-radius: 20upx;
				background-color: #EF4D3D;
				margin: 0 auto;
				margin-bottom: 46upx;
			}
			
			input{
				width: 90%;
				border: 2upx solid #e5e5e5;
				border-radius: 10upx;
				height: 80upx;
				margin: 0 auto;
				margin-bottom: 40upx;
				font-size: 24upx;
				padding: 0 20upx;
			}
		}
	}


	.search {
		border: 12upx solid #EF4D3D;
		border-radius: 20upx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 14upx 30upx;

		input {
			font-size: 24upx;
			width: 80%;
		}

		view {
			width: 96upx;
			height: 56upx;
			line-height: 56upx;
			text-align: center;
			border-radius: 20upx;
			background-color: #EF4D3D;
			font-size: 28upx;
			color: #fff;
		}
	}

	.container {
		padding: 0 15upx;

		.current {
			width: 100%;
			background-color: #fff;
			padding: 20upx;
			box-shadow: 1.75upx 1.75upx 7.01upx 0px #e5e5e5, 1.75upx 1.75upx 7.01upx 0px #e5e5e5;
			margin-top: 20upx;
			border-radius: 20upx;

			.current_top {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.fl {
					font-size: 28upx;
					color: #000;
					font-weight: bold;
				}

				.fr {
					display: flex;
					align-items: center;

					text {
						font-size: 21upx;
						color: #a6a6a6;
						padding-right: 10upx;
					}

					image {
						width: 30upx;
						height: 30upx;
					}
				}
			}

			.current_box {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-top: 15upx;

				view {
					border-bottom: 4upx solid #fff;

					image {
						width: 47upx;
						height: 47upx;
						display: block;
						margin: 0 auto;
					}

					text {
						display: block;
						font-size: 22upx;
						color: #000;
						font-weight: bold;
						text-align: center;
						padding-top: 5upx;
					}
				}

				.active {
					border-bottom: 4upx solid #EF4D3D;
				}
			}
		}

		.success {
			width: 100%;
			background-color: #fff;
			padding: 25upx;
			box-shadow: 1.75upx 1.75upx 7.01upx 0px #e5e5e5, 1.75upx 1.75upx 7.01upx 0px #e5e5e5;
			margin-top: 20upx;
			border-radius: 20upx;
			position: relative;

			.retreat {
				position: absolute;
				top: 60upx;
				right: 42upx;
				width: 81upx;
				height: 81upx;
			}

			.success_top {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.fl {
					display: flex;
					align-items: center;

					.viewtop {
						width: 96upx;
						height: 37upx;
						color: #fff;
						font-size: 22upx;
						background-color: #EF4D3D;
						text-align: center;
						line-height: 37upx;
					}

					.viewkey {
						font-size: 25upx;
						padding: 0 20upx;
						color: #383838;
					}

					.viewbox {
						width: 49upx;
						height: 26upx;
						border-radius: 8upx;
						background-color: #a6a6a6;
						text-align: center;
						line-height: 26upx;
						font-size: 17upx;
						color: #fff;
					}
				}

				.fr {
					font-size: 18upx;
					color: #a6a6a6;
					display: flex;
					align-items: center;

					text {
						font-size: 21upx;
					}

					image {
						width: 25upx;
						height: 25upx;
						margin-left: 20upx;
					}
				}
			}

			.success_key {
				.viewtop {
					display: flex;
					align-items: center;

					text {
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
						font-size: 28upx;
						color: #000;
						font-weight: bold;
					}

					image {
						width: 96upx;
						height: 96upx;
					}
				}

				.viewbox {
					margin-top: -30upx;

					text {
						display: block;
						font-size: 21upx;
						color: #383838;
						padding-top: 10upx;
					}
				}
			}

			.contact {
				padding: 10upx 0 20upx;
				border-top: 2upx solid #E5E5E5;
				border-bottom: 2upx solid #E5E5E5;
				margin-top: 20upx;

				.contact_top {
					view {
						display: flex;
						align-items: center;
						padding-top: 10upx;

						text {
							font-size: 28upx;
							color: #000;
							font-weight: bold;
						}

						.viewtop {
							color: #EF4D3D;
						}

						.viewbox {
							color: #808080;
						}
					}
				}

				.contact_key {
					line-height: 28upx;
					// display: inline-block;
					background-color: rgba(240, 77, 62, 0.1);
					font-size: 21upx;
				}

				.contact_box {
					line-height: 32upx;
					color: #EF4D3D;
					font-size: 24upx;
				}
			}

			.seperate {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-top: 18upx;

				.seperate_fl {
					display: flex;
					align-items: center;

					text {
						font-size: 24upx;
					}

					view {
						font-size: 24upx;
						color: #EF4D3D;
					}
				}

				.seperate_fr {
					font-size: 24upx;
					color: #EF4D3D;
				}
			}


			.descrip_top {
				margin-top: 20upx;
				height: 75upx;
				opacity: 1;
				background: #F0F0F0;
				padding: 0 40upx;
				display: flex;
				align-items: center;

				.box_box {
					width: 56upx;
					height: 56upx;
					opacity: 1;
					border-radius: 10upx;
					background: #FFC300;
					font-size: 38upx;
					font-weight: bold;
					color: #fff;
					text-align: center;
					line-height: 56upx;
				}

				.box_key {
					width: 56upx;
					height: 56upx;
					opacity: 1;
					border-radius: 10upx;
					background: #EF4D3D;
					font-size: 38upx;
					font-weight: bold;
					color: #fff;
					text-align: center;
					line-height: 56upx;
				}

				.descr_box {
					padding-left: 28upx;

					text {
						display: block;
						font-size: 22upx;
						color: #000;
					}
				}
			}

			.warn {
				display: flex;
				align-items: center;
				padding-top: 10upx;
				padding-left: 14upx;

				image {
					width: 26upx;
					height: 26upx;
				}

				text {
					font-size: 24upx;
					color: #000;
				}

				.warnkey {
					color: #EF4D3D;
					padding: 0 10upx;
				}
			}

			.group {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-top: 20upx;

				.group_fl {
					view {
						font-size: 21upx;
						font-weight: bold;
					}

					text {
						display: block;
						font-size: 14upx;
						color: #808080;
					}
				}

				.group_fr {
					width: 470upx;
					height: 53upx;
					border-radius: 10upx;
					background-color: #f7f5f5;
					padding: 0 25upx;
					font-size: 17upx;
					line-height: 53upx;
				}
			}

			.success_box {
				display: flex;
				align-items: center;
				justify-content: flex-end;
				padding-top: 35upx;

				view {
					width: 138upx;
					height: 48upx;
					border: 2upx solid #EF4D3D;
					line-height: 44upx;
					text-align: center;
					border-radius: 10upx;
					font-size: 26upx;
					color: #EF4D3D;
					font-weight: bold;
					margin-left: 20upx;
				}

				.viewtop {
					background-color: #EF4D3D;
					color: #fff;
				}
			}

			.success_bos {
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}


	.down {
		width: 250upx;
		height: 63upx;
		border-radius: 17upx;
		overflow: hidden;
		box-shadow: 1.75px 1.75px 7.01px 0px rgba(0, 0, 0, 0.25), 1.75px 1.75px 7.01px 0px rgba(0, 0, 0, 0.25);
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 20upx;

		view {
			width: 50%;
			font-size: 28upx;
			font-weight: bold;
			text-align: center;
			border-radius: 17upx;
			height: 63upx;
			line-height: 63upx;
		}

		.active {
			background-color: #EF4D3D;
			color: #fff;
		}
	}
	.viewboxs{
		border: 1px solid red;
		line-height: 25upx;
		font-size:18upx;
		color: #FFFFFF;
		background-color: #EF4D3D;
		border-radius: 10upx;
		margin-left: 20upx;
	}
</style>
